﻿using System.Configuration;

namespace Core.Common
{
    public class AppSettings
    {
        public static string ProductCode
        {
            get { return GetValue("ProductCode"); }
        }

        public static string IsRemembered
        {
            get { return GetValue("IsRemembered"); }
        }

        public static string GetValue(string key)
        {
            string value = ConfigurationManager.AppSettings[key];

            if (string.IsNullOrEmpty(value))
            {
                return string.Empty;
            }
            return value;
        }

        public static void SetValue(string key,string value)
        {
            Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            cfa.AppSettings.Settings.Add(key, value);
            cfa.Save();
        }
    }
}
